home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000081_icon-group-sender_Thu Oct 19 08:23:01 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9JFMlg01349
  4.     for icon-group-addresses; Thu, 19 Oct 2000 08:22:47 -0700 (MST)
  5. Message-Id: <200010191522.e9JFMlg01349@baskerville.CS.Arizona.EDU>
  6. Date: Wed, 18 Oct 2000 21:10:22 -0400 (EDT)
  7. From: Taybin Rutkin <trutkin@black.clarku.edu>
  8. To: Charles Hethcoat <CHETHCOA@oss.oceaneering.com>
  9. cc: icon-group@optima.CS.Arizona.EDU
  10. Subject: Re: Pipes in Icon
  11. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  12. Status: RO
  13. Content-Length: 1006
  14.  
  15. On Wed, 18 Oct 2000, Charles Hethcoat wrote:
  16.  
  17. > I would like to invoke a program /usr/bin/xyz from within an Icon program and use pipes to communicate with it.  I would send the command strings to xyz with a write(), and then read the results with a read().  It is important to understand that both the read() and the write() are called from within a single program.
  18.  
  19. What you're doing is creating a file at /usr/bin/xyz that is a
  20. pipe.  You're lucky this isn't overwriting the existing program.  What you
  21. need to do is create a temporary, mutually agreed upon file.  So what I
  22. would do is something like this:
  23.  
  24. tempr = open(".xyz_read", pr)
  25. tempw = open(".xyz_write", pw)
  26. execute("xyz -read_pipe .xyz_read -write_pipe .xyz_write")
  27.  
  28. Of course, you would put whatever you need in the command line.  And it
  29. might need to be run in the background.  But I believe that is the basic
  30. technique.
  31.  
  32. Taybin Rutkin -- trutkin@black.clarku.edu
  33.  
  34. Creativity can only be anarchic, capitalist, Darwinian
  35.     -- Umberto Eco
  36.  
  37.